﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace ZhangZhao.Web.H_UserGatherThirdPhotoComment
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtUserGatherThirdPhotoId.Text))
			{
				strErr+="UserGatherThirdPhotoId格式错误！\\n";	
			}
			if(this.txtCommentUserName.Text.Trim().Length==0)
			{
				strErr+="CommentUserName不能为空！\\n";	
			}
			if(this.txtCommentBody.Text.Trim().Length==0)
			{
				strErr+="CommentBody不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCommentTime.Text))
			{
				strErr+="CommentTime格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtScore.Text))
			{
				strErr+="Score格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int UserGatherThirdPhotoId=int.Parse(this.txtUserGatherThirdPhotoId.Text);
			string CommentUserName=this.txtCommentUserName.Text;
			string CommentBody=this.txtCommentBody.Text;
			DateTime CommentTime=DateTime.Parse(this.txtCommentTime.Text);
			bool IsLike=this.chkIsLike.Checked;
			bool IsRecommend=this.chkIsRecommend.Checked;
			int Score=int.Parse(this.txtScore.Text);

			ZhangZhao.Model.H_UserGatherThirdPhotoComment model=new ZhangZhao.Model.H_UserGatherThirdPhotoComment();
			model.UserGatherThirdPhotoId=UserGatherThirdPhotoId;
			model.CommentUserName=CommentUserName;
			model.CommentBody=CommentBody;
			model.CommentTime=CommentTime;
			model.IsLike=IsLike;
			model.IsRecommend=IsRecommend;
			model.Score=Score;

			ZhangZhao.BLL.H_UserGatherThirdPhotoComment bll=new ZhangZhao.BLL.H_UserGatherThirdPhotoComment();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
